package com.woniuxy.commons.interceptor.configuration;

import com.woniuxy.commons.interceptor.PermsInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * 拦截器
 */
@Configuration
public class InterceptorConfiguration implements WebMvcConfigurer {
    @Resource
    private PermsInterceptor permsInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(permsInterceptor).addPathPatterns("/**"); //对所有的路径添加过滤器
    }
}
